import {get, post} from "@/api";
import smUtil from "@/utils/smCrypto"
import {setToken} from "@/utils/TokenUtil";


const baseURL="/auth/c"

export function register(account:string,password:string,code?:string){

    return post("/client/user","/add",{
        account:account,
        password:smUtil.doSm2Encrypt(password),
        name:account
    })
}
export function login(account:string,password:string,code?:string) {

    return post(baseURL, "/doLogin", {
        account: account,
        password: smUtil.doSm2Encrypt(password)
    })
}
export function loginOut(){

    return get(baseURL, "/doLogout", ).then(()=>{
        setToken("")
    })
}

export function getUserInfo(){
    return get(baseURL,"/getLoginUser")
}

export function getPicCaptcha(){
   return get(baseURL,"/getPicCaptcha")
}